# -*- coding:utf-8 -*-
class Solution:
    # 这里要特别注意~找到任意重复的一个值并赋值到duplication[0]
    # 函数返回True/False
    def duplicate(self, numbers, duplication):
        # write code here
        res = [0 for _ in range(len(numbers) + 1)]
        for item in numbers:
            res[item] += 1
            if res[item] > 1:
                duplication[0] = item
                return True
        return False

class Solution:
    # 这里要特别注意~找到任意重复的一个值并赋值到duplication[0]
    # 函数返回True/False
    def duplicate(self, numbers, duplication):
        long = len(numbers)
        for i in range(len(numbers)):
            index = numbers[i]%long if numbers[i] >= long else numbers[i]# 未加之前的值， %长度就可以得到原来的值
            if numbers[index] > long:
                duplication[0] = index
                return True
            numbers[index] += long# 对应位置上加长度
        return False




test = Solution()
print(test.duplicate(5, [2,1,3,1,4]))